// 对接口统一处理
import requests from './request'
import mockRequests from './mockRequest'
// 三级联动接口
// /api/product/getBaseCategoryList   get 无参数

export const reqTypeNav = () => requests({ url: '/product/getBaseCategoryList', method: 'get' })
// 获取首页轮播图接口
export const reqBannerList = () => mockRequests({ url: '/banner', method: 'get' })
// 获取floor数据
export const reqFloorList = () => mockRequests({ url: '/floor', method: 'get' })
// 获取search数据 如果需要给服务器传递数据的话，params参数必须至少是一个空对象
export const reqSearchInfo = (params) => requests({ url: '/list', method: 'post', data: params })
// 获取商品详情页数据
export const reqDetailList = (skuId) => requests({ url: `/item/${skuId}`, method: 'get' })
// 添加到购物车请求(需要携带参数/{ skuId }/{ skuNum })
export const reqShopcar = (skuId, skuNum) => requests({ url: `/cart/addToCart/${skuId}/${skuNum}`, method: 'post' })
// 获取购物车数据
export const reqCartList = () => requests({ url: '/cart/cartList', method: 'get' })
// 删除购物车产品 cart/deleteCart/{skuId}  请求方式 delete
export const reqDeleteCart = (skuId) => requests({ url: `/cart/deleteCart/${skuId}`, method: 'delete' })
// 切换商品选中状态  /api/cart/checkCart/{skuID}/{isChecked}
export const reqCheckCart = (skuId, isChecked) => requests({ url: `/cart/checkCart/${skuId}/${isChecked}`, method: 'get' })
// 获取验证码 /api/user/passport/sendCode/{phone}
export const reqSendCode = (phone) => requests({ url: `/user/passport/sendCode/${phone}`, method: 'get' })
// 用户注册 /api/user/passport/register post  phone code password
export const reqRegister = (data) => requests({ url: '/user/passport/register', data, method: 'post' })
// 获取登录信息 /api/user/passport/login  post  phone password
export const reqLogin = (data) => requests({ url: '/user/passport/login', data, method: 'post' })
// 获取用户信息 /user/passport/auth/getUserInfo get (添加了token校验获取用户登录信息，用户登录只保存用户的token, 需要在请求拦截器中加上token)
export const reqUserInfo = () => requests({ url: '/user/passport/auth/getUserInfo', method: 'get' })
// 退出登录 /api/user/passport/logout  get
export const reqLogout = () => requests({ url: '/user/passport/logout', method: 'get' })
// 获取用户地址信息  /api/user/userAddress/auth/findUserAddressList  get
// 这里需要登录账号13700000000 111111 才有数据
export const reqUserAddress = () => requests({ url: '/user/userAddress/auth/findUserAddressList', method: 'get' })
// 获取订单交易页信息 /api/order/auth/trade  get
export const reqTradeInfo = () => requests({ url: '/order/auth/trade', method: 'get' })
// 提交订单 /api/order/auth/submitOrder?tradeNo={tradeNo} post
export const reqSubmitOrder = (tradeNo, data) => requests({ url: `/order/auth/submitOrder?tradeNo=${tradeNo}`, data, method: 'post' })
// 获取订单支付消息   /api/payment/weixin/createNative/{orderId}   get   orderId
export const reqPayInfo = (orderId) => requests({ url: `/payment/weixin/createNative/${orderId}`, method: 'get' })
// 查询支付状态   /api/payment/weixin/queryPayStatus/{orderId} get orderId
export const reqPayStatus = (orderId) => requests({ url: `/payment/weixin/queryPayStatus/${orderId}`, method: 'get' })
// 获取订单列表  /api/order/auth/{page}/{limit} get page limit
export const reqMyorderList = (page, limit) => requests({ url: `/order/auth/${page}/${limit}`, method: 'get' })
